package com.atguigu.reflect;

import com.atguigu.pojo.Person;
import org.junit.Test;

/**
 * @program: myIDEA
 * @description:
 * @author: Mr.zjx
 * create: 2021-07-03-22-43
 **/
public class ReflectTest{
    //对象获取
    @Test
   public void testGetClass(){
        Person person = new Person();
        Class Cla = person.getClass();
        System.out.println("Cla = " + Cla);
    }
    //静态获取
    @Test
    public void testClass(){
        Class Cla = Person.class;
        System.out.println("Cla = " + Cla);
    }
    //方法获取
    @Test
    public void testForName() throws ClassNotFoundException {
        Class Cla = Class.forName("com.atguigu.shisong.pojo.Person");
        System.out.println("Cla = " + Cla);
    }
}

